#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "floatingwindow.h"

#include <QDebug>
#include <QAction>
#include <QWidget>
#include <QStyle>
#include <QApplication>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    ,floatingWindow(new FloatingWindow())
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
    delete floatingWindow;
}

void MainWindow::on_pushButton_clicked()
{
    QObjectList settings = this->centralWidget()->children();
    for (QObject *setting : settings){
        QCheckBox *checkBox = qobject_cast<QCheckBox*>(setting);
        if (checkBox) {
            if (checkBox->objectName() == "Visible"){
                if (checkBox->isChecked()){
                    floatingWindow->show();
                }else{
                    floatingWindow->hide();
                }
            }
        }

    }
}

